<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">

<ui:composition>

	<p:dialog header="Send Message" widgetVar="messageDlg" resizable="true" height="500" modal="true" rendered="true">

		<h:panelGrid columns="3" id="messagePanelId" columnClasses="th">
			<h:outputLabel value="#{msgs.To}" />
			<!-- forceSelection should be trur, but set to false now due to the Primeface bug Issue 4170: -->
			<p:autoComplete value="#{messageBackingBean.toUserIdList}" minQueryLength="3" id="userId" completeMethod="${userBackingBean.getUserids}"
				forceSelection="false" queryDelay="500" required="true" multiple="true" title="the recipient user Id">
			</p:autoComplete>
			<p:message for="userId"></p:message>
			<h:outputLabel value="#{msgs.SUBJECT}" />
			<p:inputText id="subject" value="#{messageBackingBean.currentMessage.subject}" required="true"></p:inputText>
			<p:message for="subject"></p:message>
			<h:outputLabel value="#{msgs.SUBJECT}" />
			<p:inputTextarea value="#{messageBackingBean.currentMessage.content}" id="content" autoResize="false"></p:inputTextarea>
			<p:message for="content"></p:message>


			<h:outputText value="" />
			<h:panelGroup>
				<p:commandButton value="#{msgs.Send_button}" actionListener="#{messageBackingBean.sendMessage()}" process="@form"
					update="messagePanelId  :globalMessageId" oncomplete="handleComplete(xhr, status, args)">
				</p:commandButton>

				<p:commandButton value="#{msgs.SAVE}" actionListener="#{messageBackingBean.saveDraftMessage()}" process="messagePanelId" update="messagePanelId"
					oncomplete="handleComplete(xhr, status, args)">
				</p:commandButton>
				<p:commandButton value="#{msgs.CANCEL}" onclick="messageDlg.hide();" process="@this"></p:commandButton>
			</h:panelGroup>
		</h:panelGrid>

	</p:dialog>

</ui:composition>
</html>